<?php

namespace app\admin\validate\weixin;

use think\Validate;

class Template extends Validate
{
    /**
     * 验证规则
     */
    protected $rule = [
        'tempkey' => 'require|max:50|unique:weixin_template',
        'name' => 'require|max:100|unique:weixin_template',
        'tempid' => 'require|max:100'
    ];

    /**
     * 提示消息
     */
    protected $message = [

    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['tempkey', 'name', 'tempid'],
        'edit' => ['tempkey', 'name', 'tempid'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'tempkey' => __('Tempkey'),
            'name' => __('Name'),
            'tempid' => __('Tempid'),
        ];
        parent::__construct($rules, $message, $field);
    }
}
